@echo off

SET CFLG=-D___SYS_I486 -D___OS_WIN
rem SET GFLG=-D___GUI -mwindows
SET GFLG=-D___GUI -Dmain=SDL_main
SET IFLG=-I. -Ilib
SET LIBS=

IF "%1" EQU "-g" (
  SET CFLG=%CFLG% %GFLG%
  SET LIBS=%LIBS% -lmingw32 -lSDLmain -lSDL_ttf -lSDL
  shift
)
IF "%1" EQU "-l" (
  SET LIB=-ljpgbmp
  shift
)
IF "%1" EQU "-x" (
  SET CFLG=%CFLG% -D___DLLIMP
  SET LIB=%LIB%-dll
  shift
)
IF "%1" EQU "" (
  echo "Args: [-g] [-l] [-x] <name>"
  exit
)
SET NAM=%1
shift

echo CFLG=%CFLG%
gcc -s -O2 -Wall -o %NAM%.exe %CFLG% %IFLG% %NAM%.c -L. %LIB% %LIBS%
